//
//  CollectionViewCell.m
//  Delicious
//
//  Created by gy on 16/5/10.
//  Copyright © 2016年 gy. All rights reserved.
//

#import "CollectionViewCell.h"

@implementation CollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = [UIColor redColor];
        _imageVIEW = [[UIImageView alloc]initWithFrame:CGRectZero];
        [self.contentView addSubview:_imageVIEW];
        _imageVIEW.userInteractionEnabled = YES;
        _label = [[UILabel alloc]initWithFrame:CGRectZero];
        _label.textColor = [UIColor whiteColor];
        [self.contentView addSubview:_label];
    }
    return self;
}

- (void)layoutSubviews{
    _imageVIEW.frame = self.contentView.bounds;
    _label.frame = CGRectMake(50, self.imageVIEW.frame.size.height - 40, 100, 20);
    
}
- (void)setModel:(Collection *)model{
    _model = model;
    [self.imageVIEW sd_setImageWithURL:[NSURL URLWithString:_model.imageUrl]];
    self.label.text = _model.name;
}
@end
